import express from 'express'
export const router = express.Router()
import store from '../../store/PayList/Yx.js'
//获取商户用户列表
router.get('/Pay/GetPayListYx', async (req, res) => {
  const DataArr = await store.getPayData()
  //判断是否等于数组
  console.log(DataArr)
  if (DataArr instanceof Array)
    res.status(200).send({ code: 1, message: '获取数据成功', data: DataArr })
  else res.status(400).send({ code: 400, message: `获取数据失败` })
})
//删除商户用户列表
router.delete('/Pay/DeletePayListYx', async (req, res) => {
  console.log(`查看我的`, req.body.id)
  let str = await store.delPayData(req.body.id)
  if (str == '删除成功') {
    res.status(200).send({ code: 1, message: '删除成功' })
  } else {
    res.status(400).send({ code: 400, message: '删除失败' })
  }
})
//修改
router.put('/Pay/PutPayListYx', async (req, res) => {
  let str = await store.putPayData(req.body.obj)
  if (str === '修改成功') res.status(200).send({ code: 1, message: '修改成功' })
  else res.status(400).send({ code: 400, message: '修改失败' })
})
export default router
